package com.twu.bm.football;

import org.junit.Test;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintStream;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

public class TeamListOptionTest {

    PrintStream printStream = mock(PrintStream.class);
    BufferedReader reader = mock(BufferedReader.class);
    TeamListOption teamListOption = new TeamListOption(printStream, reader);
    private String teamName = "Bengals";

    @Test
    public void shouldRequestTeamNameWhenPerformActionIsCalled() throws IOException {
        teamListOption.performAction();
        verify(printStream).println("Enter a team name:");
    }

    @Test
    public void shouldPrintTeamNameWhenReaderReturnsString() throws IOException {
        when(reader.readLine())
                .thenReturn(teamName);
        teamListOption.performAction();
        verify(printStream).println(teamName);
    }
}
